<?php

class Footermenu_Widget_FooterMenuController extends Engine_Content_Widget_Abstract
{

  public function indexAction()
  {
    // Get collection
    if( !($id = (int) $this->_getParam('collection_id')) ||
        !($collection = Engine_Api::_()->getItem('footermenu_collection', $id)) ) {
      return $this->setNoRender();
    }	
    $table = Engine_Api::_()->getDbtable('categories', 'footermenu');
    $categoriesTableName = $table->info('name');
    $select = $table->select();
	$select
	  ->where("{$categoriesTableName}.cid = ?", $id)
	  ->order( 'category_id ASC' );
	$categories = $table->fetchAll($select);
	$this->view->categories = $categories;
  }    
}  